import {app} from 'electron';
import log4js from "log4js"

const userData = app.getPath("userData"); // 用户目录，不同平台路就不一样

log4js.configure({
    appenders: {
        logfile: {
            type: "dateFile",
            filename: `${userData}/logs/logfile.log`
        },
        datalogfile: {
            type: "dateFile",
            filename: `${userData}/logs/datalogfile.log`,
            pattern: ".yyyy-MM-dd-hh-mm-ss-SSS"
        },
        consoleout: { type: "console" }
    },
    categories: {
        default: { appenders: ["logfile", "consoleout"], level: "debug" }
    }
});

const logger = log4js.getLogger();

export default logger